package com.smart.campus.web.utils;

import com.smart.campus.school.domain.Student;

public class StudentUtil {

    /**
     * 获取学生id
     * @return
     */
    public static Long getStudentId(){
       Student student = (Student) HttpServletUtils.getHttpSession().getAttribute("loginStudent");
       if(student ==  null){
           return null;
       }
       return student.getId();
    }

    /**
     * 获取学生
     * @return
     */
    public static Student getStudentInfo(){
        Student student = (Student) HttpServletUtils.getHttpSession().getAttribute("loginStudent");
        if(student ==  null){
            return null;
        }
        return student;
    }


    /**
     * 更新学生session
     * @return
     */
    public static void updateStudentSession(Student student){
        HttpServletUtils.getHttpSession().setAttribute("loginStudent",student);
    }
}
